<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div></div>
    <script>
        let div = document.getElementsByTagName('div')[0];
        let persons = [
            { "username": "xiaoming1", "password": "1111" },
            { "username": "xiaoming2", "password": "222" },
            { "username": "xiaoming3", "password": "33333" }
        ]
        let user = { username: "xiaomin", password: "12345" }
        // let a = persons.find(function (item) {
        //     return item.username == user.username
        // })
        
        // console.log(a)
        if (persons.find(item=>item.username==user.username)) {
            div.innerText = '已有注册'

        } else {
            div.innerText = '注册成功'
            persons.push(user)

        }
        console.log(persons)
        // console.log(a)
        console.log(typeof [1,2,3,4])
    </script>
</body>

</html>